﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace PingPong
{
    class AIPad
    {
        public Texture2D AITexture;
        public Vector2 AIPosition;
        public Rectangle AIRectangle;
        public int AIWidth;
        public int AIHeight;
        public int screenWidth;
        int screenHeight;

        public int AISpeed = 2;

        public AIPad(Texture2D newAITexture, Vector2 newAIPosition, int newAIWidth, int newAIHeight, int newScreenHeight, int newScreenWidth)
        {
            AITexture = newAITexture;
            AIPosition = newAIPosition;
            AIWidth = newAIWidth;
            AIHeight = newAIHeight;
            screenWidth = newScreenWidth;
            screenHeight = newScreenHeight;
            AIRectangle = new Rectangle(screenWidth / 2, 0, AITexture.Width, AITexture.Height);
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(AITexture, AIPosition, AIRectangle, Color.White);
        }

        public void Update(int ballPosition)
        {
            if ( AIPosition.X >= ballPosition)
                AIPosition.X -= AISpeed;
            if (AIPosition.X <= ballPosition)
                AIPosition.X += AISpeed;
        }
    }
}
